@model List<DotnetSpider.Portal.Entity.DockerRepository>

@section breadcrumb{
    <li >
        <a href="#">Repository</a>
    </li>
}

@section header{
    Repository<small v-text="moduleDescription"></small>
}

<div class="col-xs-12">
    <div class="box">
        <div class="box-header">
            <div class="box-title">
                &ensp;
            </div>
            <div class="box-tools">
                <a class="btn btn-default btn-sm btn-flat" href="/docker-repository/add">Add</a>
            </div>
        </div>
        <!-- /.box-header -->
        <div class="box-body table-responsive no-padding">
            <table class="table table-bordered">
                <tbody>
                <tr>
                    <th>Name</th>
                    <th>Registy</th>
                    <th>Repository</th>
                    <th>CreationTime</th>
                    <th>Action</th>
                </tr>
                @if (Model == null || !Model.Any())
                {
                    <tr>
                        <td colspan="3">
                            None
                        </td>
                    </tr>
                }
                else
                {
                    foreach (var item in Model)
                    {
                        <tr >
                            <td>
                                <span>@item.Name</span>
                            </td>
                            <td>
                                <span>@(string.IsNullOrWhiteSpace(item.Schema) ? "" : $"{item.Schema}://{item.Registry}")</span>
                            </td>
                            <td>
                                <span>@item.Repository</span>
                            </td>
                            <td>
                                <span>@item.CreationTime.ToLocalTime().ToString("yyyy-MM-dd hh:mm:ss")</span>
                            </td>
                            <td>
                                <button class="btn btn-default btn-sm  btn-flat" onclick="remove('@item.Id')">Delete</button>
                                <a class="btn btn-default btn-sm  btn-flat" href="spider/create?registry=@(item.Registry)&repository=@(item.Repository)">Create</a>
                            </td>
                        </tr>
                    }
                }

                </tbody>
            </table>
        </div>
        <!-- /.box-body -->
    </div>
    <!-- /.box -->
</div>

@section scripts{
    <environment names="Development">
        <script src="~/js/repository.js" asp-append-version="true"></script>
    </environment>
    <environment names="Staging,Production">
        <script src="~/js/repository.min.js" asp-append-version="true"></script>
    </environment>
}